var a = require("../../@babel/runtime/helpers/defineProperty"),
  t = require("../../res/www.a9a.cn.js"),
  e = getApp(),
  i = 2,
  n = !0,
  o = wx.getStorageSync("COOK_U");
Page({
  data: {
    topbar: ["谁看过我", "我看过谁"],
    currentTab: 0,
    loading_flag: !1,
    loading_ico_flag: !1,
    loading_str: "拼命加载中",
  },
  topbarFn: function (a) {
    var t = parseInt(a.currentTarget.dataset.idx);
    this.setData({ currentTab: t }),
      this.get_data(t + 1),
      wx.setNavigationBarTitle({ title: this.data.topbar[t] });
  },
  onLoad: function (a) {
    var o = a.t,
      r = 1 == o ? this.data.topbar[0] : this.data.topbar[1];
    wx.setNavigationBarTitle({ title: r });
    var s = this;
    e.get_config("_ZEAI").then(function (a) {
      s.setData({
        color: a.color,
        rgbcolor: t.c16_rgb(a.color),
        currentTab: o - 1,
      }),
        (i = 2),
        (n = !0),
        s.get_data(o);
    });
  },
  get_data: function (t) {
    var i = this;
    t = parseInt(t);
    e.chklogin().then(function (a) {
      a || wx.navigateBack();
    }),
      (n = !1),
      (o = wx.getStorageSync("COOK_U")),
      e.ajax({
        url: "my_browse.php",
        data: { submitok: "list", t: t, openid: o.openid },
        success: function (e) {
          switch (t) {
            case 1:
              var o = e.LIST1;
              break;
            case 2:
              o = e.LIST2;
          }
          if (1 == e.flag) {
            var r;
            if (
              (i.setData({ blurU: e.blurU }),
              o.length >= 15 &&
                i.setData({ loading_flag: !0, loading_ico_flag: !0 }),
              0 == o.length)
            )
              i.setData(a({ loading_flag: !1 }, "nodatabox" + t, !0));
            else
              i.setData(
                (a((r = {}), "LIST" + t + "[0]", o),
                a(r, "nodatabox" + t, !1),
                a(r, "loading_flag", !1),
                r)
              );
            n = !0;
          } else
            wx.showModal({
              content: e.msg,
              confirmColor: i.data.color,
              confirmText: "朕知道了",
              showCancel: !1,
              success: function (a) {
                wx.navigateBack();
              },
            });
        },
      });
  },
  onReachBottom: function () {
    var t = this,
      r = parseInt(this.data.currentTab) + 1;
    switch (r) {
      case 1:
        var s = this.data.LIST1;
        break;
      case 2:
        s = this.data.LIST2;
    }
    (o = wx.getStorageSync("COOK_U")),
      n &&
        ((n = !1),
        t.setData({ loading_ico_flag: !0 }),
        e.ajax({
          url: "my_browse.php",
          data: { submitok: "list", t: r, p: i, openid: o.openid },
          success: function (e) {
            switch (r) {
              case 1:
                var o = e.LIST1;
                break;
              case 2:
                o = e.LIST2;
            }
            if (o.length < 1)
              return (
                t.setData({
                  loading_flag: !0,
                  loading_ico_flag: !1,
                  loading_str: "已全部加载完成",
                }),
                void (n = !1)
              );
            t.setData(a({}, "LIST" + r + "[" + s.length + "]", o)),
              (i += 1),
              (n = !0);
          },
        }));
  },
  uidFn: function (a) {
    var t = a.currentTarget.dataset.uid;
    wx.navigateTo({ url: "../u/u?uid=" + t });
  },
  vipFn: function () {
    wx.navigateTo({ url: "../my_vip/my_vip" });
  },
});
